my_list = [10,20,30,40,50]
# print(my_list[3])

# 通过切片来获取指定的元素
# 语法：列表[起始:结束]
# 语法：列表[起始:结束:步长]
# print(my_list[0:])
# print(my_list[0:5:1])
# my_list = [1,2,3] + [4,5,6]

# * 可以将列表重复指定的次数
# my_list = [1,2,3] * 5
#
# print(my_list)

# 创建一个列表
stus = ['孙悟空','猪八戒','沙和尚','唐僧','蜘蛛精','白骨精','沙和尚','沙和尚']
# print(stus.index("沙和尚",7))

# print(stus.count("沙和尚"))

# stus[0]="zhangsan"
# del stus[2]
# 在给切片进行赋值时，只能使用序列
# stus[0:2] = ["lisi",'wangwu',"cuihua","lili"]
# print(stus[::2])
# stus[::2] = ['牛魔王','红孩儿','二郎神',""]
# stus.append("zhangsan")
# stus.insert(2,'唐僧')

# stus.extend(["zhangsan","lisi"])
# print(stus)

# # clear()
# # 清空序列
# stus.clear()
# result = stus.pop() # 删除最后一个
# print('result =',result)
# stus.reverse()
# stus.sort(reverse=True)
# print(stus)